// components/drinkitem/drinkitem.js
var data = require('../../utils/data')
Component({
    /**
     * 页面的初始数据
     */
    properties:{
        did:{
            type:Number,
            value:0
        }, 
       name:{
            type:String,
            value:"drink_name",
        },
        introduce:{
            type:String,
            value:"人气|YYDS，无限回归",
        },
        tips:{
            type:String,
            value:"tip",
        },
       price:{
            type:Number,
            value:29
        },
        murl:{
            type:String,
            value:"http://127.0.0.1:3000/image/drinks/sy.png"
        },
        
    },
    methods: {
        addDrink(e) {
            const drinksList=data.goodList;
            drinksList.push(this.properties)
            console.log(drinksList) 
            wx.showToast({
                title: this.properties.name+"\n添加购物车成功",
                icon:"none"
              })
        },
    },
    data: {
        nprice:{
            type:Number,
            value:0
        }
    },
    lifetimes:{
        attached(){
            const p=(this.properties.price*0.48)
            this.setData({
                nprice:p
            })
        }
    }
})